<!DOCTYPE html>
<html class="x-admin-sm">

{include file="common/static" /}
{include file="common/resources" /}
    <body>
        <div class="x-nav">
            <span class="layui-breadcrumb">
                <a href="">首页</a>
                <a href="">演示</a>
                <a>
                    <cite>导航元素</cite></a>
            </span>
            <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" onclick="location.reload()" title="刷新">
                <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i>
            </a>
        </div>
        <div class="layui-fluid">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md12">
                    <div class="layui-card">
                        <div class="layui-card-body ">
                            <form class="layui-form layui-col-space5">

                                <div class="layui-input-inline layui-show-xs-block">
                                    <select name="contrller">
                                        <option>支付方式</option>
                                        <option>支付宝</option>
                                        <option>微信</option>
                                        <option>货到付款</option></select>
                                </div>

                                <div class="layui-input-inline layui-show-xs-block">
                                    <input type="text" name="username" placeholder="请输入订单号" autocomplete="off" class="layui-input">
                                </div>
                                <div class="layui-input-inline layui-show-xs-block">
                                    <button class="layui-btn" lay-submit="" lay-filter="sreach">
                                        <i class="layui-icon">&#xe615;</i></button>
                                </div>
                            </form>
                        </div>

                        <div class="layui-card-body ">
                            <table class="layui-table layui-form">
                                <thead>
                                    <tr>
                                        <th>名称</th>
                                        <th>价格</th>
                                        <th>库存</th>
                                        <th>数量</th>
                                        <th>操作</th></tr>
                                </thead>
                                <tbody>
                                    {volist name="list" id="vo"}
                                    <tr>
                                        <td>{$vo.name}</td>
                                        <td>{$vo.price}</td>
                                        <td>{$vo.number}</td>
                                        <td>
                                            <input type="text" id="num" placeholder="请输入数量" autocomplete="off" class="layui-input" value="1">
                                        </td>
                                        <td class="td-manage">
                                            <input type="hidden" value="{$room_id}" id="room_id">
                                            <button title="查看" onclick="adds({$vo.id})">
                                                <i class="layui-icon">&#xe63c;</i></button>
                                        </td>
                                    </tr>
                                    {/volist}
                                </tbody>
                            </table>
                            {$list|raw}
                        </div>

                    </div>
                </div>
            </div>
        </div>
    </body>

<script>layui.use(['laydate', 'form'],
        function() {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });
function adds(id){
    $.ajax({
        type:"post",
        url: "{:url('home/atrial/goods')}",
        data: {
            goods_id:id,
            room_id:$('#room_id').val(),
            num:$('#num').val()
        },
        success: function(data){
            console.log(data);
            toastr.error(data.msg);
            if(data.code == 100){
                setTimeout(function () {
                    layer.closeAll();
                    parent.location.reload();
                },1500);
            }
        }});
}

</script>


</html>